//
//  NewStasticCell.swift
//  HuaYun
//
//  Created by enghou on 2018/11/24.
//  Copyright © 2018 xyxorigation. All rights reserved.
//

import UIKit

class NewStasticCell: UITableViewCell {

    var _model: JSON?
    
    @IBOutlet weak var nameLabel: UILabel!
    
    @IBOutlet weak var yearNumLabel: UILabel!
    
    @IBOutlet weak var monthLabel: UILabel!
    
    @IBOutlet weak var today: UILabel!
    
    var currentday: Bool = false
    
    var currentmonth: Bool = false
    
    var model: JSON? {
        set{
            _model = newValue
            nameLabel.text = _model?.contents?["name"]?.rawString()
            if let year = _model?.contents?["sum"]?.int {
                let yearnum = String(year / 1000000)
                yearNumLabel.text = yearnum.rmbformat
            } else {
                if let year = _model?.contents?["thisYear"]?.int {
                    let yearnum = String(year / 1000000)
                    yearNumLabel.text = yearnum.rmbformat
                } else {
                    yearNumLabel.text = "0"
                }
            }
            
            if let todaynum = _model?.contents?["toDay"]?.int {
                today.text = String(todaynum / 1000000).rmbformat
            } else {
                today.text = "0"
            }
            
            if let tomonthnum = _model?.contents?["toMonth"]?.int {
                monthLabel.text = String(tomonthnum / 1000000).rmbformat
            } else {
                monthLabel.text = "0"
            }
        }
        get{
            return _model
        }
    }
    
}
